package de.tum.in.eist.poll.pub.shared;

import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.Set;
import java.util.HashSet;

public class Lecture implements IsSerializable {
	private int id;
	private String name;
	private Set<Student> students;
	private Set<User> usersToNotify;
	private Lecturer lecturer;
	
	public Lecture() {
	}
	

	public Lecture(int id, String name, Lecturer lecturer) {
		this.id = id;
		this.name = name;
		this.lecturer = lecturer;
		students = new HashSet<Student>();
	}
	
	public int getId() {
		return id;
	}
	
	public String getName() {
		return name;
	}
	
	
	public Lecturer getLecturer() {
		return lecturer;
	}
	
	
	protected Set<Student> getStudents() {
		return students;
	}
	
	public void addStudent(Student student) {
		students.add(student);
	}
	

	public boolean containsStudent(Student student) {
		int tempid = student.getId();
		for(Student containedStudent : students) {
			if(containedStudent.getId() == tempid) {
				return true;
			}
		}
		return false;
	}
}
